import logging

from common.read_common import read
from common.token01 import login
from api.ihrm_ import Ihrm
from common import assert_tools
from common.mysql_ import DB_Tool
import pytest
from config import BASE_PATH


class TestPost01:
    def setup_class(self):
        delete  = DB_Tool().iud("delete from bs_user where mobile = '13512345678'")
        return delete
    def teardown(self):
        delete = DB_Tool().iud("delete from bs_user where mobile = '13512345678'")
        return delete
    @pytest.mark.parametrize("dase,req_body,status,success,code,message",read(BASE_PATH+"/data/ihrm_.json"))
    def test01(self,dase,req_body,status,success,code,message):
        a = Ihrm()
        req_headers = login()
        resp = a.ihrm_post(req_headers,req_body)
        #print(dase,resp.json())
        logging.info(f"{dase}{resp.json()}")
        assert_tools.assert_tools(resp,status,success,code,message)

